#include <iostream>
#include <algorithm>

using namespace std;
const int N = 1e4 + 10;
int n;
int c[N];

void dprime(int x)
{
    for(int i = 2;i <= x / i;i ++)
    {
        int cnt = 0;
        while(x % i == 0)
        {
            cnt ++;
            x /= i;
        }
        c[i] += cnt;
    }
    if(x > 1) c[x] ++; 
}
int main()
{
    cin >> n;
    for(int i = 2;i <= n;i ++)
    {
        dprime(i);
    }
    for(int i = 2;i <= n;i ++)
    {
        if(c[i])
        {
            cout << i << " " << c[i] << endl;
        }
    }
    return 0;

}